package com.mjh.bean;

import java.util.Date;
import org.apache.struts2.json.annotations.JSON;
import com.mjh.comm.*;

public class Task {

	private String id;
	
	private String name;
	
	private String classPath;
	
	private String schedule;
	
	private Date lastExcuteDate;
	
	private Date nextExcuteDate;
	
	private int lastExcuteState;
	
	private boolean isRunning;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getClassPath() {
		return classPath;
	}

	public void setClassPath(String classPath) {
		this.classPath = classPath;
	}

	public String getSchedule() {
		return schedule;
	}

	public void setSchedule(String schedule) {
		this.schedule = schedule;
	}
	@JSON(format="yyyy-MM-dd HH:mm")
	public Date getLastExcuteDate() {
		return lastExcuteDate;
	}

	public void setLastExcuteDate(Date lastExcuteDate) {
		this.lastExcuteDate = lastExcuteDate;
	}

	public int getLastExcuteState() {
		return lastExcuteState;
	}

	public String getLastExcuteStateDesc(){
		return Constant.OPERATE_DESC[this.lastExcuteState];
	}
	
	public void setLastExcuteState(int lastExcuteState) {
		this.lastExcuteState = lastExcuteState;
	}

	public boolean isRunning() {
		return isRunning;
	}

	public void setRunning(boolean isRunning) {
		this.isRunning = isRunning;
	}
	
	public String getRunningDesc(){
		return this.isRunning ? "正在运行" : "已停止";
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	@JSON(format="yyyy-MM-dd HH:mm")
	public Date getNextExcuteDate() {
		return nextExcuteDate;
	}

	public void setNextExcuteDate(Date nextExcuteDate) {
		this.nextExcuteDate = nextExcuteDate;
	}
}
